<script type="text/javascript">
	$(function() {
		$("#optimistic").click(function() {
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/team/optimistic",
				data:"teamId=<?=$rs['teamId']?>",
				success:function() {
					$("#user_optimistic").html(<?=$rs['optimistic']?>+1);
					$("#optimistic").unbind("click");
				}
			});
		});
		
		$("#care").click(function() {
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/team/care",
				data:"teamId=<?=$rs['teamId']?>",
				success:function() {
					$("#user_care").html(<?=$rs['care']?>+1);
					$("#care").unbind("click");
				}
			});
		});
		$("#applyToTeam").click(function() {
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/team/applyJoinToTeam",
				data:"teamId=<?=$rs['teamId']?>",
				success:function() {
					alert("申请成功");
				}
			});
		});

		
		$("#tdzy_rgd2").load("<?=base_url()?>index.php/team/dynamic_links/<?=$rs['teamId']?>/image/1");
		
		$("#link_ul li").each(function() {
			$(this).click(function() {
				$("#moreList").attr("title",1);
				$(this).addClass("on").siblings().removeClass("on");
				var title = $(this).attr("title");
				$("#tdzy_rgd2").load("<?=base_url()?>index.php/team/dynamic_links/<?=$rs['teamId']?>/"+title+"/1");
			});
		});
		
		$("#team_editNotice").click(function(){
			var content = $("#team_notice").html();
			window.content = content;
			content = '<form><textarea style="width:100%;" id="area_notice">' + content + '</textarea></form>';
			$("#team_notice").html(content);
			$("#team_editNotice").addClass("div_display");
			$("#saveAndCancel").removeClass("div_display");
		});
		$("#btn_cancel").click(function() {
			$("#team_notice").html(window.content);
			$("#saveAndCancel").addClass("div_display");
			$("#team_editNotice").removeClass("div_display");
		});
		$("#btn_save").click(function() {
			var new_content = $("#area_notice").val();
			$("#team_notice").html(new_content);
			$("#saveAndCancel").addClass("div_display");
			$("#team_editNotice").removeClass("div_display");
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/team/updateDynamicNotice",
				data:"teamId=<?=$rs['teamId']?>&content="+new_content
			});
		});
		
		$("#team_editDesc").click(function(){
			var content = $("#teamDesc").html();
			window.content = content;
			content = '<form><textarea style="width:100%;" id="area_desc">' + content + '</textarea></form>';
			$("#teamDesc").html(content);
			$("#team_editDesc").addClass("div_display");
			$("#saveAndCancel_tdjj").removeClass("div_display");
		});
		$("#btn_cancel_tdjj").click(function() {
			$("#teamDesc").html(window.content);
			$("#saveAndCancel_tdjj").addClass("div_display");
			$("#team_editDesc").removeClass("div_display");
		});
		$("#btn_save_tdjj").click(function() {
			var new_content = $("#area_desc").val();
			$("#teamDesc").html(new_content);
			$("#saveAndCancel_tdjj").addClass("div_display");
			$("#team_editDesc").removeClass("div_display");
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/team/updateDynamicDesc",
				data:"teamId=<?=$rs['teamId']?>&content="+new_content
			});
		});
		
		$("#moreList").click(function(){
			$(".dynamic_reply").each(function() {
				$(this).unbind("click");
			});
			var pageNo=$(this).attr("title");
			var selectType;
			$("#link_ul li").each(function() {
				if($(this).hasClass("on")){
					selectType = $(this).attr("title");
				}
			});
			$.post("<?=base_url()?>index.php/team/dynamic_links/"+<?=$rs['teamId']?>+"/"+selectType+"/"+pageNo,{},function(data){
				$("#tdzy_rgd2").append(data);
			},"html");
			
			pageNo=parseInt(pageNo);
			$(this).attr("title",pageNo+1);
		});
	});
</script>
	<div class="content">
		<div class="tdzy_lf">
			<div class="tdzy_lfd1">
                <div class="tdzy_img"></div>
				<h3><?=$rs['teamName']?></h3>
				<p class="tdzy_p1"><a href="javascript:void(0);" id="care">+在意</a>(<span id="user_care"><?=$rs['care']?></span>)</p>
				<p class="tdzy_p1"><a href="javascript:void(0);" id="optimistic">+看好</a>(<span id="user_optimistic"><?=$rs['optimistic']?></span>)</p>
				<p class="tdzy_p2"><input type="button" id="applyToTeam" class="tdzy_put"/></p>
			</div>
			
			<div class="bmlf_lf1">
				<ul>
					<li class="lf1_hover1"><a href="<?=base_url()?>index.php/team/teamYearbook/<?=$rs['teamId']?>" target="_blank"><strong>年鉴</strong></a></li>
					<li class="lf1_hover2"><a href="<?=base_url()?>index.php/team/teamPhotowall/<?=$rs['teamId']?>" target="_blank"><strong>照片墙</strong></a></li>
					<li class="lf1_hover8"><a href="<?=base_url()?>index.php/team/listUsersByTeamId/<?=$rs['teamId']?>" target="_blank"><strong>团体成员</strong></a></li>
				</ul>
			</div><!-- end bmlf_lf1 -->
		</div><!-- end tdzy_lf -->
		<div class="tdzy_rg">
			<div class="tdzy_rgd1">
				<div class="tdzy_rd1"></div>
				<div class="tdzy_rd2">
					<div style="clear:both;"></div>
					<div class="tdzy_rd21">
						<div class="tdzy_rdimg"><img src="<?=base_url()?>assets/images/tdzy_04.gif" width="30" height="34"/></div>
						<div class="tdjj">
							<h2><span><strong>-</strong></span>团队简介</h2>
							<p>
								<span id="teamDesc"><?=$rs['teamDescription']?></span>
								<span id="team_editDesc" class="edit_td">
									<a href="javascript:void(0);" class="edit_color">编辑</a>
								</span>
								<span id="saveAndCancel_tdjj" class="div_display edit_td">
									<a href="javascript:void(0);" id="btn_save_tdjj" class="edit_color">保存</a>
									<a href="javascript:void(0);" id="btn_cancel_tdjj" class="edit_color">取消</a>
								</span>
							</p>
						</div>
					</div>
					<div style="clear:both;"></div>
					<div class="tdzy_rd21">
					<div style="clear:both;"></div>
						<div class="tdzy_rdimg" style="margin-top:25px;"><img src="<?=base_url()?>assets/images/tdzy_05.gif" width="46" height="36" /></div>
						<div class="tdjj" style="margin-top:25px;">
							<h2><span><strong>-</strong></span>团队公告</h2>
							<p>
								<span id="team_notice"><?=$rs['teamNotice']?></span>
								<span id="team_editNotice" class="edit_td">
									<a href="javascript:void(0);" class="edit_color">编辑</a>
								</span>
								<span id="saveAndCancel" class="div_display edit_td">
									<a href="javascript:void(0);" id="btn_save" class="edit_color">保存</a>
									<a href="javascript:void(0);" id="btn_cancel" class="edit_color">取消</a>
								</span>
							</p>
						</div>
					</div>
				</div>
				<div class="tdzy_rd3"></div>
			</div><!-- end tdzy_rgd1 -->
            <div class="clear"></div>
            <div class="nav_area">
				<ul id="link_ul">
					<li class="on" title="image"><div class="nav_01"></div></li>
					<li title="text"><div class="nav_02"></div></li>
					<li title="links"><div class="nav_03"></div></li>
					<li title="video"><div class="nav_04"></div></li>
				</ul>
			</div>
			<div class="tdzy_rgd2" id="tdzy_rgd2"> 
				
			</div>

			<div class="moreFoot">
				<a href="javascript:void(0);" title="2" class="c_tx" id="moreList">更多<<< </a>
			</div>
		</div><!-- end tdzy_rg -->	
	</div><!-- end content -->
	<div class="footer">
		<p class="foot_p">Copyright © 2013 湾湾网. All Rights Reserved. 冀ICP备12021992号</p>
	</div>
</div><!-- end wrap -->
</body>
</html>
